home *** CD-ROM | disk | FTP | other *** search
- /*****
- * CDictTestApp.c
- *
- * Application methods for a typical application.
- *
- *****/
-
- #include "CDictTestApp.h"
- #include "CDictTestDoc.h"
-
- extern OSType gSignature;
-
- /***
- * IDictTestApp
- *
- * Initialize the application. Your initialization method should
- * at least call the inherited method. If your application class
- * defines its own instance variables or global variables, this
- * is a good place to initialize them.
- *
- ***/
-
- void CDictTestApp::IDictTestApp(void)
-
- {
- CApplication::IApplication(30, 32767L, 2048L);
- }
-
-
-
- /***
- * SetUpFileParameters
- *
- * In this routine, you specify the kinds of files your
- * application opens.
- *
- *
- ***/
-
- void CDictTestApp::SetUpFileParameters(void)
-
- {
- inherited::SetUpFileParameters(); /* Be sure to call the default method */
-
- sfNumTypes = 1;
- sfFileTypes[0] = 'DICT';
-
-
- gSignature = 'danp';
- }
-
-
-
- /***
- * DoCommand
- *
- * Your application will probably handle its own commands.
- * Remember, the command numbers from 1-1023 are reserved.
- * The file Commands.h contains all the reserved commands.
- *
- * Be sure to call the default method, so you can get
- * the default behvior for standard commands.
- *
- ***/
- void CDictTestApp::DoCommand(long theCommand)
-
- {
- switch (theCommand) {
-
- /* Your commands go here */
-
- default: inherited::DoCommand(theCommand);
- break;
- }
- }
-
- /***
- * Exit
- *
- * Chances are you won't need this method.
- * This is the last chance your application gets to clean up
- * things like temporary files.
- *
- ***/
-
- void CDictTestApp::Exit()
-
- {
- /* your exit handler here */
- }
-
-
- /***
- * CreateDocument
- *
- * The user chose New from the File menu.
- * In this method, you need to create a document and send it
- * a NewFile() message.
- *
- ***/
-
- void CDictTestApp::CreateDocument()
-
- {
- CDictTestDoc *theDocument;
-
- theDocument = new(CDictTestDoc);
-
- /**
- ** Send your document an initialization
- ** message. The first argument is the
- ** supervisor (the application). The second
- ** argument is TRUE if the document is printable.
- **
- **/
-
- theDocument->IDictTestDoc(this, TRUE);
-
- /**
- ** Send the document a NewFile() message.
- ** The document will open a window, and
- ** set up the heart of the application.
- **
- **/
- theDocument->NewFile();
- }
-
- /***
- * OpenDocument
- *
- * The user chose Open… from the File menu.
- * In this method you need to create a document
- * and send it an OpenFile() message.
- *
- * The macSFReply is a good SFReply record that contains
- * the name and vRefNum of the file the user chose to
- * open.
- *
- ***/
-
- void CDictTestApp::OpenDocument(SFReply *macSFReply)
-
- {
- CDictTestDoc *theDocument;
-
- theDocument = new(CDictTestDoc);
-
- /**
- ** Send your document an initialization
- ** message. The first argument is the
- ** supervisor (the application). The second
- ** argument is TRUE if the document is printable.
- **
- **/
-
- theDocument->IDictTestDoc(this, TRUE);
-
- /**
- ** Send the document an OpenFile() message.
- ** The document will open a window, open
- ** the file specified in the macSFReply record,
- ** and display it in its window.
- **
- **/
- theDocument->OpenFile(macSFReply);
- }